# from torch.utils.tensorboard import  SummaryWriter
# from PIL import Image
# import numpy as np
#
# writer = SummaryWriter("logs")
# image_path="D:\\PytorchLearn\\蜜蜂数据集\\hymenoptera_data\\train\\ants_image\\36439863_0bec9f554f.jpg"
# img_PIL=Image.open(image_path)
# img_array=np.array(img_PIL)
# print(type(img_array))
# print(img_array.shape)
#
# writer.add_image("train",img_tensor=img_array,global_step=1,dataformats='HWC')
#
#
# # y=x
# for i in range(100):
#     writer.add_scalar("y=2x",scalar_value=3*i,global_step=i);
#
# writer.close()

import torch
from torchvision import transforms
from PIL import Image

# python中的用法  -> tensor 数据类型
# 通过transforms.ToTensor去解决两个问题

# 2.Tensor数据类型和一般的有什么区别,为什么我们需要

# 绝对路径:D:\PytorchLearn\pytorch_learning\Project1\ants_image\5650366_e22b7e1065.jpg
# 相对路径 ants_image/5650366_e22b7e1065.jpg
image_path="D:\\PytorchLearn\\pytorch_learning\\Project1\\ants_image\\5650366_e22b7e1065.jpg"
img=Image.open(image_path)

# 1.transforms该如何使用(python)
tensor_trans=transforms.ToTensor()
tensor_img=tensor_trans(img)
print(tensor_img)
